﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SportStore.WebUI.Models.CartIndexViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    SportStore: Your cart
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Your cart</h2>
    <table width="90%" align="center">
        <thead>
            <tr>
                <th align="center">
                    Quantity
                </th>
                <th align="center">
                    Item
                </th>
                <th align="center">
                    Price
                </th>
                <th align="center">
                    Subtotal
                </th>
            </tr>
        </thead>
        <tbody>
            <%foreach (var line in Model.Cart.Lines)
              {%>
            <tr>
                <td align="center">
                    <%= Html.Encode(line.Quantity)%>
                </td>
                <td align="center">
                    <%= Html.Encode(line.Product.Name)%>
                </td>
                <td align="center">
                    <%= Html.Encode(line.Product.Price.ToString("c"))%>
                </td>
                <td align="center">
                    <%= Html.Encode((line.Product.Price * line.Quantity).ToString("c"))%>
                </td>
            </tr>
            <%} %>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="3" align="right">
                    Total:
                </td>
                <td align="right">
                    <%= Html.Encode(Model.Cart.ComputeTotalValue().ToString("c")) %>
                </td>
            </tr>
        </tfoot>
    </table>
    <p align="center" class="acctionButtons">
        <a href="<%= Html.Encode(Model.ReturnUrl) %>">Continue shopping</a>
    </p>
</asp:Content>
